/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.osdtsystem.dataset;

/**
 * A composite view consisting of several subviews.
 * @author Martin Haulrich and Matthias Buch-Kromann
 */
public class CompositeView implements View {
    final View[] subviews;

    public CompositeView(View... subviews) {
        this.subviews = subviews;
    }

    @Override
    public final int subviews() {
        return subviews.length;
    }

    @Override
    public final View subview(int i) {
        return subviews[i];
    }

    @Override
    public final String feature(Dataset dataset, int identifier) {
        StringBuilder s = new StringBuilder();
        String separator = "";
        for (int i = 0; i < subviews(); ++i) {
            s.append(separator);
            s.append(subviews[i].feature(dataset, identifier));
        }
        return s.toString();
    }
}
